import axios from "axios";
import Vue from "vue";
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'


Vue.prototype.$http = axios;
// 在requset拦截其中展示进度条  NProgress.start()
axios.defaults.baseURL = "http://39.98.123.211/api/";

axios.interceptors.request.use(config => {
  NProgress.start()
  // console.log(config);
  config.headers.Authorization = window.sessionStorage.getItem("token");
  return config;
});
// 在response拦截其中隐藏进度条   NProgress.done()

axios.interceptors.response.use(config => {
  NProgress.done()

  return config
})